﻿#ifndef JZ_SCRIPT_ITEM_VISTOR_H_
#define JZ_SCRIPT_ITEM_VISTOR_H_

#include "JZScriptItem.h"
#include "JZNodeFlow.h"
#include "JZNodeFunction.h"
#include "JZNodeEvent.h"
#include "JZNodeValue.h"

class JZScriptItemVisitor
{
public:    
    JZScriptItemVisitor(JZScriptItem *item = nullptr);
    virtual ~JZScriptItemVisitor();

    void setScript(JZScriptItem *item);        
    void visit();

    QList<JZNodePin*> inputPin(int node_id, int pin_id);

    QList<JZNode*> flowInputNode(JZNode* node);
    QList<JZNode*> flowInputNodeRecursively(JZNode *node);

    QList<JZNode*> dataInputNode(JZNode *node);
    QList<JZNode*> dataInputNode(JZNode* node, int pin_id);
    QList<JZNode*> dataInputNodeRecursively(JZNode *node);

    JZNode *nextFlowNode(JZNode *node, int id);    
    JZNode *prevFlowNode(JZNode *node);

protected:
    virtual void visitNode(JZNode *node);
    virtual void visitSelf(JZNode *node);
        
    JZScriptItem *m_script;
    QList<JZNode*> m_hasVistorNode;
};

#endif